import request from '@/utils/request'
// 获取部门机构
export function treeselect() {
  return request({
    url: 'system/dept/treeselect',
    method: 'get',
  })
}

export function roleDeptTreeselect(roleId) {
  return request({
    url: `/system/dept/roleDeptTreeselect/${ roleId }`,
    method: 'get',
  })
}

export function listDept(query) {
  return request({
    url: '/system/dept/list',
    method: 'get',
    params: query,
  })
}
export function listDeptTable(query?) {
  return request({
    url: '/system/dept/listTable',
    method: 'get',
    params: query,
  })
}

export function listDeptExcludeChild(deptId) {
  return request({
    url: `/system/dept/list/exclude/${ deptId }`,
    method: 'get',
  })
}

// 根据id查询部门详细
export function getDept(deptId) {
  return request({
    url: `/system/dept/get/${ deptId }`,
    method: 'get',
  })
}

export function delDept(deptId) {
  return request({
    url: `/system/dept/${ deptId }`,
    method: 'delete',
  })
}
// 修改部门
export function updateDept(data) {
  return request({
    url: '/system/dept',
    method: 'put',
    data,
  })
}
// 新增部门
export function addDept(data) {
  return request({
    url: '/system/dept',
    method: 'post',
    data,
  })
}
export function getOrganization() {
  return request({
    url: '/system/dept/getOrganization',
  })
}
